import { Validator } from "vee-validate";
export default {
  // 手机号
  mobile(filed, msg) {
    Validator.extend(filed, {
      getMessage: () => msg,
      validate: value => /^1[34578][0-9]{9}$/.test(value)
    });
  },
  // 验证身份证
  idCard(filed, msg) {
    Validator.extend(filed, {
      getMessage: () => msg,
      validate: value =>
        /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(
          value
        )
    });
  },
  Withdraw(filed, msg) {
    Validator.extend(filed, {
      getMessage: () => msg,
      validate: value => value > 100
    });
  }
};
